package com.wenmang.networklib.client;

import com.wenmang.networklib.frame.JSONHttpListener;
import com.wenmang.networklib.frame.JSONHttpService;
import com.wenmang.networklib.frame.WMHttpTask;
import com.wenmang.networklib.frame.WMThreadPoolManager;

/**
 * desc: ${DESC}
 * author: created by zhoujx on 2018/10/18 17:58
 */
public class WMNetClient {

    public static <T, M> void sendJSONRequest(T requestParmas, String url, Class<M> responseClass, WMCallback<M> callback) {
        JSONHttpService jsonHttpService = new JSONHttpService();
        JSONHttpListener<M> jsonHttpListener = new JSONHttpListener<>(responseClass, callback);
        WMHttpTask<T> httpTask = new WMHttpTask<>(requestParmas, url, jsonHttpService, jsonHttpListener);
        WMThreadPoolManager.getInStance().execute(httpTask);
    }
}
